package fakedata

import (
	"doctor_api_backend/config"
	"doctor_api_backend/models"
	"fmt"
	"math/rand"
)

// 模板应该是写死的，不能拿来模拟

// 生成病种模板
func SeedSickTemplate() {

	commonSymptoms := []string{"头痛", "发热", "咳嗽", "腹痛", "乏力"}
	diagnosisDescription := []string{"感冒", "流感", "肺炎", "肠胃炎", "贫血"}
	treatmentPlan := []string{"休息", "多喝水", "药物治疗", "物理降温"}
	notes := []string{"注意休息", "多喝水", "药物治疗", "物理降温"}

	// 生成100条病种模板
	for i := 0; i < 100; i++ {
		sickTemplate := models.SickTemplate{
			SickTemplateCode:     fmt.Sprintf("S%d", i),
			DiseaseName:          fmt.Sprintf("病种名称%d", i),                                   // 病种名称
			ICD10Code:            fmt.Sprintf("A%d", i),                                      // ICD-10标准编码
			CommonSymptoms:       commonSymptoms[rand.Intn(len(commonSymptoms))],             // 常见症状
			DiagnosisDescription: diagnosisDescription[rand.Intn(len(diagnosisDescription))], // 诊断描述
			TreatmentPlan:        treatmentPlan[rand.Intn(len(treatmentPlan))],               // 治疗方案
			Notes:                notes[rand.Intn(len(notes))],                               // 其他说明
		}
		config.DB.Create(&sickTemplate)
	}
	fmt.Println("100 条假 `病种模板`数据已成功插入数据库")
}
